package com.shuw.com.beingfortextproject.utils;
/**
 * 描述  处理时间间隔interval
 */

public class TimeUtils {
	private static long[] timeQunee=new long[2];// doubleClick
	public interface DoCallBack{
		void outTimeTodo();//超过给定时间
		void inTimeTodo();//在时间间隔内
	}
	public static void setInterval(long gap,DoCallBack callBack){
		timeQunee[timeQunee.length-1]= System.currentTimeMillis();
		if ((timeQunee[timeQunee.length-1] -timeQunee[0] ) > gap) {
			callBack.outTimeTodo();
			System.arraycopy(timeQunee,1,timeQunee,0,timeQunee.length-1);
		} else {
			callBack.inTimeTodo();
		}
	}
}
